package com.milloc.db.service;

import com.milloc.db.common.metadata.MetaDataHelper;
import com.milloc.db.common.metadata.MetaDataResponse;
import com.milloc.db.entity.ParameterEntity;
import com.milloc.db.entity.SQLEntity;

import java.util.List;
import java.util.Map;

/**
 * 运行SQL的Service
 *
 * @author gongdeming
 * @create 2019-08-23
 */
public interface SQLRunnerService {
    /**
     * 运行SQL
     *
     * @param sqlEntity sqlEntity
     * @param params    参数
     * @return 运行结果
     */
    Object runSQL(SQLEntity sqlEntity, Map<String, Object> params);

    /**
     * 运行SQL并且返回返回结果的信息
     *
     * @param sqlEntity sqlEntity
     * @param params    params
     * @return 返回参数信息和返回结果
     */
    MetaDataResponse<?> runSQLWithMetaData(SQLEntity sqlEntity, Map<String, Object> params);

    /**
     * 重新加载数据源
     *
     * @param dataSourceEntityId dataSourceEntityId
     */
    void reloadDataSource(String dataSourceEntityId);

    /**
     * 重新加载sql
     *
     * @param sqlEntityId sqlEntityId
     */
    void reloadSQL(String sqlEntityId);
}
